package com.neusoft.neuiotms.dcom.converter;

import org.springframework.stereotype.Component;

import com.neusoft.bizcore.web.dto.AbstractConverter;
import com.neusoft.neuiotms.dcom.dto.ResidentUserDTO;
import com.neusoft.neuiotms.dcom.model.ResidentUser;

@Component
public class ResidentUserConverter extends AbstractConverter<ResidentUser, ResidentUserDTO> {

    @Override
    public ResidentUser toModel(final ResidentUserDTO dto) {
        final ResidentUser model = new ResidentUser();
        model.setName(dto.getName());
        model.setUsername(dto.getUsername());
        return model;
    }

    @Override
    public ResidentUserDTO toDTO(final ResidentUser model, final boolean forListView) {

        final ResidentUserDTO dto = new ResidentUserDTO();
        dto.setId(model.getId());
        dto.setName(model.getName());
        dto.setUsername(model.getUsername());
        return dto;
    }

}
